package com.utopia.keyvalue.store.index;

import com.utopia.keyvalue.store.impl.disk.IndexEntry;

import junit.framework.TestCase;

/**
 * @author yanjiaqiang
 * @date 2011-3-17
 * @version $Id: IndexEntityTest.java 5 2011-03-22 09:23:42Z JiaqiangYan@gmail.com $
 */
public class IndexEntityTest extends TestCase {

	public void testIndexEntity() {
		IndexEntry index = new IndexEntry();
		index.setAvailable(true);
		index.setDatafileIndex(1);
		index.setDatafilePosOffset(1024);
		index.setKeyhash(123456);
		index.setOffset(11111);

		byte[] data = index.toBytes();
		IndexEntry newIndex = new IndexEntry();
		newIndex.fromBytes(data);

		assertEquals(index.equals(newIndex), true);
	}
}
